package bz.yfw.example.s3blazeds.part2.view
{
	import bz.yfw.example.s3blazeds.part2.model.view.EmpViewModel;
	import bz.yfw.example.s3blazeds.part2.view.state.EmpEditViewState;
	
	import flash.media.CameraUI;
	
	import spark.components.Button;
	import spark.components.View;
	import spark.primitives.BitmapImage;
	
	/**
	 * 社員編集(カメラ写真)View
	 * @author tokufxug http://twitter.com/tokufxug
	 */ 
	public class EmpEditCameraView extends View
	{
		[SkinPart]
		public var bmpimgShashin:BitmapImage;
		
		[SkinPart]
		public var btnShot:Button;
		
		[SkinPart]
		public var btnConfirm:Button;
		
		[SkinPart]
		public var btnBack:Button;
		
		private var requiredCurrentState:String;
		
		private var _viewModel:EmpViewModel;
		
		public function EmpEditCameraView() {
			super.title = "写真撮影";
		}
		
		public override function createReturnObject():Object {
			return data;
		}
		
		public function get viewModel():EmpViewModel {
			return _viewModel;
		}
		
		public function set viewModel(value:EmpViewModel):void {
			_viewModel = value;
		}
		
		protected override function getCurrentSkinState():String{
			if (CameraUI.isSupported) {
				return EmpEditViewState.CAMERA_STATE;
			}
			if (requiredCurrentState == null) {
				return EmpEditViewState.NORMAL_STATE;
			}
			return requiredCurrentState;
		}
	}
}